const rootReducer = (state, action) => {
  if (!state) {
    return {
      appTheme: 'light',
      appSize: 'small',
      theme: {
        default: {
          Card: {
            borderRadius: 10,
            enableShadow: false,
          },
          TextField: {
            style: {color: '#666'},
            hideUnderline: true,
          },
          Button: {
            borderRadius: 60,
          },
        },
        diy: {
          light: {
            primaryColor: '#f76e03', //主色调
            secondaryColor: '#68b1ff', //副色调
            thirdColor: '#84dd64', //辅色调
            headingColor: '#333333', //标题颜色
            subheadingColor: '#333333', //副标题颜色
            bodyColor: '#666666', //正文颜色
            subbodyColor: '#999999', //备注颜色
            lintColor: '#f0f0f0', //备注颜色
            errorColor: '#ff5c58', //报错颜色
            successColor: '#52ab36', //成功颜色
            warnColor: '#FF963C', //警告颜色
            backgroundColor: '#f0f0f0', //背景色
            colorBgSecondary: '#f9f9f9',
            colorBgThird: '#f0f0f0',
            cardbackgroundColor: '#f5f6f9', //卡片背景色
            colorTextBase: '#000000', //纯色
            colorCardBg: '#ffffff',
            undoBg: '#f6f2d4',
            doingBg: '#7dcec6',
            doneBg: '#36528c',
            undo: '#7D4209',
            doing: '#000000',
            done: '#FFFFFF',
          },
          dark: {
            primaryColor: '#A3DAFB', //主色调
            secondaryColor: '#68b1ff', //副色调
            thirdColor: '#84dd64', //辅色调
            headingColor: '#cccccc', //标题颜色
            subheadingColor: '#cccccc', //副标题颜色
            bodyColor: '#999999', //正文颜色
            subbodyColor: '#999999', //备注颜色
            lintColor: '#cccccc', //备注颜色
            errorColor: '#ff5c58', //报错颜色
            successColor: '#52ab36', //成功颜色
            warnColor: '#FF963C', //警告颜色
            backgroundColor: '#333333', //背景色
            colorBgSecondary: 'rgba(0,0,0,0.4)',
            colorBgThird: 'rgba(0,0,0,0.4)',
            cardbackgroundColor: 'rgba(255,255,255,0.1)', //卡片背景色
            colorTextBase: '#dddddd', //纯色
            colorCardBg: '#121212',
            undoBg: '#f6f2d4',
            doingBg: '#7dcec6',
            doneBg: '#36528c',
            undo: '#7D4209',
            doing: '#000000',
            done: '#FFFFFF',
          },
          small: {
            heading: {fontSize: 18, fontWeight: '600'}, //标题字号
            subheading: {fontSize: 16, fontWeight: '500'}, //副标题字号
            body: {fontSize: 14, fontWeight: 'normal'}, //正文字号
            subbody: {fontSize: 12, fontWeight: 'normal'}, //辅助文字字号
          },
          smalls: {
            page: 20, //文本间距
            card: 12, //卡片间距
            gridGutter: 16, //网格间距
          },
          middle: {
            heading: {fontSize: 22, fontWeight: '600'}, //标题字号
            subheading: {fontSize: 20, fontWeight: '500'}, //副标题字号
            body: {fontSize: 18, fontWeight: 'normal'}, //正文字号
            subbody: {fontSize: 16, fontWeight: 'normal'}, //辅助文字字号
          },
          middles: {
            page: 22, //文本间距
            card: 14, //卡片间距
            gridGutter: 18, //网格间距
          },
          large: {
            heading: {fontSize: 24, fontWeight: '600'}, //标题字号
            subheading: {fontSize: 22, fontWeight: '500'}, //副标题字号
            body: {fontSize: 20, fontWeight: 'normal'}, //正文字号
            subbody: {fontSize: 18, fontWeight: 'normal'}, //辅助文字字号
          },
          larges: {
            page: 24, //文本间距
            card: 16, //卡片间距
            gridGutter: 20, //网格间距
          },
        },
      },
      statusbars: {
        translucent: false,
        backgroundColor: '#f0f0f0',
        animated: true,
        barStyle: 'dark-content',
      },
      userInfo: {
        username: '',
      },
      curProject: {},
      vftime: 0,
    };
  }

  switch (action.type) {
    case 'CHANGE_THEME':
      return {...state, appTheme: action.appTheme};
    case 'CHANGE_STATUSBAR':
      return {...state, statusbars: action.statusbars};
    case 'CHANGE_USERINFO':
      return {...state, userInfo: action.userInfo};
    case 'CHANGE_CURPROJECT':
      return {...state, curProject: action.curProject};
    case 'CHANGE_VFTIME':
      return {...state, vftime: action.vftime};
    default:
      return state;
  }
};

export default rootReducer;
